﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Service.Login;

public partial class 登录界面 : System.Web.UI.Page
{
    private LogIn t_login;
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button3_Click(object sender, EventArgs e) //系统管理员登录
    {
        Boolean is_enter = false;
        t_login = new LogBackstage();
        t_login.Initialize( user_name.Text,pass_word.Text );
        is_enter = t_login.IsLegal();
        if ( is_enter )
        {
            Server.Transfer("ManageUserInfo.aspx", true);
        }
    }
    protected void Button1_Click(object sender, EventArgs e) //注册用户登录
    {
       Boolean is_enter = false;
       if ( userOrStaff.Text.Equals("员工") )
       {
           t_login = new LaborialStaff();
           t_login.Initialize( user_name.Text,pass_word.Text );
           is_enter = t_login.IsLegal();
           Session["UserType"] = "员工";
       }

        if( userOrStaff.Text.Equals ("用户") )
        {

           t_login = new User();
           t_login.Initialize( user_name.Text,pass_word.Text );
           is_enter = t_login.IsLegal();
           Session["UserType"] = "用户";
        }
        if (userOrStaff.Text.Equals("信息管理员"))
        {
            t_login = new InfoManager();
            t_login.Initialize(user_name.Text, pass_word.Text);
            is_enter = t_login.IsLegal();
            Session["UserType"] = "信息管理员";
        }

        if ( is_enter )
        {
             Server.Transfer("RegisteredUser.aspx",true);//跳转问题:1.系统管理员 2.信息管理员 3.普通注册用户 
                                              //判断角色跳转到相应的页面
        }
         
    }

    protected void Button2_Click(object sender, EventArgs e) //游客通道
    {
        Boolean is_record;
        t_login = new Visitor();
        t_login.Initialize("ip","time");//此处要求时间和IP地址
        is_record = t_login.IsLegal();
        if ( is_record )
        {
            t_login.Record();
            Server.Transfer("Visitor.aspx", true);
        }//此处要判断IP地址是否合法，目前还没做
    }

    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {

    }
    protected void pass_word_TextChanged(object sender, EventArgs e)
    {

    }
    protected void userOrStaff_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}
